//
//  PoisonCollectionViewCell.swift
//  Game
//
//  Created by woniu on 2025/9/25.
//

import UIKit

class PoisonCollectionViewCell: UICollectionViewCell {
    
    // 卡片视图
    var cardView: PoisonCardView!
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        setupUI()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    private func setupUI() {
        // 创建卡片视图
        cardView = PoisonCardView()
        contentView.addSubview(cardView)
        
        // 设置约束
        cardView.snp.makeConstraints { make in
            make.edges.equalToSuperview()
        }
    }
    
    // 配置单元格
    func configure(with word: String) {
        cardView.word = word
        // 重置卡片状态
        cardView.resetCard()
    }
    
    override func prepareForReuse() {
        super.prepareForReuse()
        // 重置卡片状态
        cardView.resetCard()
    }
}